/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Home.java
 *
 * Created on 03/02/2013, 16:23:18
 */
package com.prsistema.Inicio;

import com.prsistema.Clientes.ClientePainel;
import com.prsistema.DAO.Conexao;
import com.prsistema.Estoque.EstoquePainel;
import com.prsistema.Fornecedores.FornecedorPainel;
import com.prsistema.Receitas.ReceitaPainel;
import com.prsistema.Vendas.VendaPainel;
import java.awt.CardLayout;

/**
 *
 * @author Leonardo
 */
public class Home extends javax.swing.JFrame {

    /** Creates new form Home */
    private Conexao con;
    private CardLayout gerenciadorDeCartas;
    private VendaPainel vendas;

    public Home(Conexao con) {
        
        initComponents();
        
        this.con = con;
        this.vendas = new VendaPainel(this.con);

        gerenciadorDeCartas = new CardLayout();
        painelMonte.setLayout(gerenciadorDeCartas);

        painelMonte.add(new ClientePainel(this.con), "CLIENTE");
        painelMonte.add(new EstoquePainel(this.con), "ESTOQUE");
        painelMonte.add(new FornecedorPainel(con), "FORNECEDOR");
        painelMonte.add(new ReceitaPainel(this.con), "RECEITA");
        painelMonte.add(this.vendas, "VENDA");

        this.setLocationRelativeTo(null);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        painelModulos = new javax.swing.JPanel();
        btnClientes = new javax.swing.JButton();
        btnEstoque = new javax.swing.JButton();
        btnFinanceiro = new javax.swing.JButton();
        btnFornecedores = new javax.swing.JButton();
        btnFuncionarios = new javax.swing.JButton();
        btnReceitas = new javax.swing.JButton();
        btnVendas = new javax.swing.JButton();
        painelMonte = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        menuSair = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("PR Sistemas");
        setIconImages(null);
        setMinimumSize(new java.awt.Dimension(0, 720));
        setResizable(false);

        painelModulos.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "MÓDULOS", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Calibri", 0, 13))); // NOI18N

        btnClientes.setFont(new java.awt.Font("Calibri", 1, 14));
        btnClientes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/prsistema/ImagensIcones/btnClientes.png"))); // NOI18N
        btnClientes.setText("Clientes");
        btnClientes.setMaximumSize(new java.awt.Dimension(170, 57));
        btnClientes.setMinimumSize(new java.awt.Dimension(165, 57));
        btnClientes.setPreferredSize(new java.awt.Dimension(165, 57));
        btnClientes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnClientesActionPerformed(evt);
            }
        });

        btnEstoque.setFont(new java.awt.Font("Calibri", 1, 14));
        btnEstoque.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/prsistema/ImagensIcones/btnEstoque.png"))); // NOI18N
        btnEstoque.setText("Estoque");
        btnEstoque.setPreferredSize(new java.awt.Dimension(165, 57));
        btnEstoque.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEstoqueActionPerformed(evt);
            }
        });

        btnFinanceiro.setFont(new java.awt.Font("Calibri", 1, 14));
        btnFinanceiro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/prsistema/ImagensIcones/btnFinanceiro.png"))); // NOI18N
        btnFinanceiro.setText("Financeiro");
        btnFinanceiro.setPreferredSize(new java.awt.Dimension(165, 57));

        btnFornecedores.setFont(new java.awt.Font("Calibri", 1, 14));
        btnFornecedores.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/prsistema/ImagensIcones/btnFornecedores.png"))); // NOI18N
        btnFornecedores.setText("Fornecedores");
        btnFornecedores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFornecedoresActionPerformed(evt);
            }
        });

        btnFuncionarios.setFont(new java.awt.Font("Calibri", 1, 14));
        btnFuncionarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/prsistema/ImagensIcones/btnFuncionarios.png"))); // NOI18N
        btnFuncionarios.setText("Funcionários");
        btnFuncionarios.setPreferredSize(new java.awt.Dimension(165, 57));

        btnReceitas.setFont(new java.awt.Font("Calibri", 1, 14));
        btnReceitas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/prsistema/ImagensIcones/btnReceitas.png"))); // NOI18N
        btnReceitas.setText("Receitas");
        btnReceitas.setPreferredSize(new java.awt.Dimension(165, 57));
        btnReceitas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnReceitasActionPerformed(evt);
            }
        });

        btnVendas.setFont(new java.awt.Font("Calibri", 1, 14));
        btnVendas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/prsistema/ImagensIcones/btnVendas1.png"))); // NOI18N
        btnVendas.setText("Vendas");
        btnVendas.setMaximumSize(new java.awt.Dimension(165, 57));
        btnVendas.setMinimumSize(new java.awt.Dimension(165, 57));
        btnVendas.setPreferredSize(new java.awt.Dimension(165, 57));
        btnVendas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnVendasActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout painelModulosLayout = new javax.swing.GroupLayout(painelModulos);
        painelModulos.setLayout(painelModulosLayout);
        painelModulosLayout.setHorizontalGroup(
            painelModulosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelModulosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnClientes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnFinanceiro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnFornecedores)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnFuncionarios, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnReceitas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnVendas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        painelModulosLayout.setVerticalGroup(
            painelModulosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelModulosLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelModulosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnClientes, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                    .addComponent(btnEstoque, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
                    .addComponent(btnFinanceiro, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                    .addComponent(btnFornecedores, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
                    .addComponent(btnFuncionarios, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
                    .addComponent(btnVendas, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
                    .addComponent(btnReceitas, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE))
                .addContainerGap())
        );

        painelMonte.setMinimumSize(new java.awt.Dimension(1227, 302));

        javax.swing.GroupLayout painelMonteLayout = new javax.swing.GroupLayout(painelMonte);
        painelMonte.setLayout(painelMonteLayout);
        painelMonteLayout.setHorizontalGroup(
            painelMonteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1227, Short.MAX_VALUE)
        );
        painelMonteLayout.setVerticalGroup(
            painelMonteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 304, Short.MAX_VALUE)
        );

        jToolBar1.setRollover(true);

        jLabel1.setText("Aqui pode ser colocada uma barra de status, ou um feed de lembretes...");
        jToolBar1.add(jLabel1);

        jMenu1.setText("Arquivo");
        jMenu1.addMenuListener(new javax.swing.event.MenuListener() {
            public void menuDeselected(javax.swing.event.MenuEvent evt) {
            }
            public void menuCanceled(javax.swing.event.MenuEvent evt) {
            }
            public void menuSelected(javax.swing.event.MenuEvent evt) {
                jMenu1MenuSelected(evt);
            }
        });
        jMenu1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu1ActionPerformed(evt);
            }
        });

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText("Back-up");
        jMenu1.add(jMenuItem1);
        jMenu1.add(jSeparator1);

        menuSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/prsistema/ImagensIcones/menuSair.png"))); // NOI18N
        menuSair.setText("Sair");
        menuSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSairActionPerformed(evt);
            }
        });
        jMenu1.add(menuSair);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Usuários");

        jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem3.setText("Permissões");
        jMenu2.add(jMenuItem3);

        jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/prsistema/ImagensIcones/menuPerfil.png"))); // NOI18N
        jMenuItem4.setText("Perfil");
        jMenu2.add(jMenuItem4);
        jMenu2.add(jSeparator2);

        jMenuItem5.setText("Gerenciador");
        jMenu2.add(jMenuItem5);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Ajuda");
        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(painelMonte, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(painelModulos, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jToolBar1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1227, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(painelModulos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(painelMonte, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnReceitasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnReceitasActionPerformed
    gerenciadorDeCartas.show(painelMonte, "RECEITA");
}//GEN-LAST:event_btnReceitasActionPerformed

private void btnClientesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClientesActionPerformed
    gerenciadorDeCartas.show(painelMonte, "CLIENTE");
}//GEN-LAST:event_btnClientesActionPerformed

private void btnVendasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVendasActionPerformed
    gerenciadorDeCartas.show(painelMonte, "VENDA");
}//GEN-LAST:event_btnVendasActionPerformed

private void btnEstoqueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEstoqueActionPerformed
    gerenciadorDeCartas.show(painelMonte, "ESTOQUE");
}//GEN-LAST:event_btnEstoqueActionPerformed

private void btnFornecedoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFornecedoresActionPerformed
    gerenciadorDeCartas.show(painelMonte, "FORNECEDOR");
}//GEN-LAST:event_btnFornecedoresActionPerformed

private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed

}//GEN-LAST:event_jMenu1ActionPerformed

private void jMenu1MenuSelected(javax.swing.event.MenuEvent evt) {//GEN-FIRST:event_jMenu1MenuSelected

}//GEN-LAST:event_jMenu1MenuSelected

private void menuSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSairActionPerformed
    new Login().setVisible(true);
    this.dispose();
}//GEN-LAST:event_menuSairActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Home(new Conexao()).setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnClientes;
    private javax.swing.JButton btnEstoque;
    private javax.swing.JButton btnFinanceiro;
    private javax.swing.JButton btnFornecedores;
    private javax.swing.JButton btnFuncionarios;
    private javax.swing.JButton btnReceitas;
    private javax.swing.JButton btnVendas;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JMenuItem menuSair;
    private javax.swing.JPanel painelModulos;
    private javax.swing.JPanel painelMonte;
    // End of variables declaration//GEN-END:variables
}
